Repository navigation
[BUGFIX] TimeSeriesChart: match byName overrides exactly in the migration - #954
Merged
Merged
Conversation
…tion The regexp match added for byRegexp overrides also applied to byName, so a byName option was used as an unanchored regexp: "5m" also matched "15m", which failed the migration when "15m" had its own color, and a name that is not a valid regexp failed it too. A target without legendFormat failed on null =~ string. byName now compares the legendFormat exactly. The regexp is only evaluated for byRegexp overrides on a target with a legendFormat, behind comprehension guards, since an error in any operand of && or || fails the expression. Fixes perses/perses#4786 Signed-off-by: Mohit Mishra <immadmohit@gmail.com>
Contributor
Author
|
@jgbernalp could you please review this, whenever you get some time? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes perses/perses#4786
The regexp match added for
byRegexpoverrides in #334 also applied tobyName, so abyNameoption was used as an unanchored regexp. In the migration:5malso matched the target15m; with a second override for15m, the two colors conflicted and the migration failed (spec.#querySettings.1.colorValue: 2 errors in empty disjunction);byNameoption that is not a valid regexp, such asrate(5m, failed withinvalid regexp;legendFormatfailed withcannot use null (type null) as type string in =~.byNamenow compares thelegendFormatexactly. The regexp is only evaluated forbyRegexpon a target with alegendFormat. This is done with comprehension guards rather than&&: an error in any operand of&&or||fails the expression, solegendFormat != null && legendFormat =~ ...still fails (I tried it).New tests:
override-byname-exact-match:byNameoverrides for5m,15mandrate(5m; each target gets only its own color.override-without-legendformat:byNameandbyRegexpoverrides on a target withoutlegendFormat; no query setting.Both fail without the change and pass with it.
percli plugin test-schemas --plugin.path=timeserieschartpasses (20 tests) with percli v0.55.1, the version used by CI, andcue fmtv0.17.1 doesn't change the file.I also ran the fixed script in a Perses server (main, TimeSeriesChart 0.15.0-beta.1): the three reproducers of the issue and the dashboard 8919 from grafana.com now migrate (HTTP 200) instead of returning a 400, and its panel
系统平均负载gets the four expected colors (three frombyName, one frombyRegexp).byRegexppatterns that RE2 doesn't support, such as lookaheads, still fail the migration, as before; that is left out of this change.Screenshots
N/A
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes